<template>
  <div class="radar-setting">
    <el-form ref="radarSetting"
             :model="setting"
             label-position="top"
             style="height:auto;">
      <el-form-item :label="$t('custom.component.gadget.dimension')">
        <el-select v-model="setting.valueFieldsNameMeasureX"
                   clearable
                   :placeholder="$t('custom.component.gadget.dimensionPlaceholder')"
                   style="width:80%;">
          <el-option v-for="(item,index) in fieldsList"
                     :key="index"
                     :label="item.name"
                     :value="item.name"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('custom.component.gadget.measure')">
        <el-select v-model="setting.valueFieldsNameManyY"
                   style="width:80%;"
                   multiple
                   clearable
                   collapse-tags
                   :placeholder="setting.valueFieldsNameManyY.length>0? '' : $t('custom.component.gadget.measurePlaceholder')">
          <el-option v-for="(item,index) in fieldsList"
                     :key="index"
                     :label="item.name"
                     :value="item.name"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('custom.component.gadget.showaxislabel')">
        <el-switch
          v-model="setting.axisLabel">
        </el-switch>
 
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import Index from '../../dashboard-filter/index.vue'
export default {
  name: 'ChartRadarSetting',
  components: { Index },
  data () {
    return {
      dataSource: [],
      setting: {
        stackedStatistics: false,
        stackedStatisticsSort: 'descending',
        showColumnLimit: null,
        color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
        labelFontSize: '',
        xAxisFontSize: '12',
        title: '',
        gridHeight: '85%',
        gridTop: '11%',
        valueFieldsNameMeasureX: '',
        valueFieldsNameMeasureGroup: null,
        valueFieldsNameManyY: [],
        manyMeasure: false,
        drillThroughStatus: true,
        tooltip: {
          enable: true
        },
        axisLabel:true

      },
    }
  },
  props: [
    'data', 'fieldsList'
  ],
  watch: {
    data (value, oldValue) {
      return this.updateSetting(value)
    },
  },
  computed: {
  },
  created () {
    if (this.data) {
      this.$set(this.data)
    }
  },
  methods: {
    getData () {
      return this.setting
    },
    updateSetting (value, list, layerStatus) {
      this._.merge(this.setting, value.gadgetSetting)
      this.$emit('update:data', this.setting)
    }

  }
}
</script>

<style lang="scss">

</style>
